#pragma once
#include <typescommon.h>

// COMMAND_PROTOCOL_USE_ADDR:0 for no need addr protocol,like udp/ip/can
// COMMAND_PROTOCOL_USE_ADDR:1 for need addr protocol,like 485
#define COMMAND_PROTOCOL_USE_ADDR 1
// compile master function
#define COMMAND_MASTER_CALL_DEFINE 1
#define COMMAND_DEVICE_CALL_DEFINE 1

#define PROTOCOL_BROADCAST_485ADDRESS 0XFF
#define PROTOCOL_PACK_MAX_SIZE 1100
enum commandExcuteResultEnum
{
    commandExcuteResultUnkown = -1,
    commandExcuteResultOk = 0,
    commandExcuteResultOtherError,
};
#pragma pack(1)
struct commandCommonStruct
{
    struct
    {
        uint16_t command;
        uint16_t serialNumber;//16byte, not change.for diffrent
        uint8_t addr485;// for remain.
        uint8_t devType;//for remain. master have to know device's type.
        uint16_t responseFlag;
    };
    union
    {
        uint8_t commandData[1];
    };
};
#pragma pack()

